{% extends "djdb/internal_page.html" %}

{% load common_extras %}
{% load djdb_extras %}

{% block breadcrumbs %}
<a href="/">chipradio home</a> /
<a href="/djdb/">DJ Database home</a>
{% endblock %}

{% block content %}

{% block extrahead %}
<script type="text/javascript" 
    src="/media/common/js/jquery/jquery-1.3.1.js"></script>
<script type="text/javascript" 
    src="/media/common/js/jquery-autocomplete/jquery.autocomplete.js"></script>
<script type="text/javascript" src="/media/djdb/js/djdb.js"></script>
<script type="text/javascript" src="/media/djdb/js/djdb_user.js"></script>
{% endblock %}

{% ifequal dj None %}
<form method="post" action="/djdb/user">
  DJ Name: <input id="id_user" name="user"/>
  <input id="id_user_key" type="hidden" name="user_key"/>
  <input type="submit" name="go" value="Go"/>
</form>

{% else %}
  {% ifequal dj.key user.key %}
    {% if user.is_superuser %}
<h3>You are a superuser!</h3>
    {% endif %}

<h3>Roles</h3>
    {% if dj.roles %}
{{ dj.roles|join:", " }}
    {% else %}
None
    {% endif %}
  {% endifequal %}

<h3>Tracks Played</h3>

  {% for dt, events in playlist_events %}
{{ dt|date:"D F j, Y P" }}
<table>
    {% for event in events %}
  <tr>
    <td>{{ event.established_display|date:"P" }}</td>
    {% if event.artist %}
    <td><a href="{{ event.artist.url }}">{{ event.artist_name }}</a></td>
    {% else %}
    <td>{{ event.artist_name }}</td>
    {% endif %}
    {% if event.album %}
    <td><a href="{{ event.album.url }}">{{ event.album_title }}</a></td>
    {% else %}
    <td>{{ event.album_title }}</td>
    {% endif %}
    <td>{{ event.track_title }}</td>
    <td>{{ event.label_display }}</td>
  </tr>
    {% endfor %}
</table>
  {% endfor %}

<a href="/djdb/tracks_played/{{ dj.key.id }}">See more tracks...</a>

<h3>Reviews</h3>

  {% if reviews %}
<ul style="padding-left: 15px">
  {% for rev in reviews %}
  <li>
    <a href="{{ rev.subject.url }}">{{ rev.subject.album_artist.name }} / {{ rev.subject.title }},</a> posted Posted {{ rev.created_display|date:"F j, Y P" }}
    {% ifequal user.key rev.author.key %}
[ <a href="/djdb/album/{{ rev.subject.album_id }}/edit_review/{{ rev.key }}">Edit</a> ]
    {% endifequal %}
    <blockquote>{{ rev.truncated_text }}</blockquote>

  </li>
  {% endfor %}
</ul>

<a href="/djdb/reviews?author_key={{ dj.key }}">See more reviews...</a>
  {% else %}
None!
  {% endif %}
{% endifequal %}

{% endblock %}

